package main

import (
	"fmt"
	"second-go/app"
	"second-go/config"
	. "second-go/log/logger"
)

const (
	DevConfig  string = "config/appConfig-dev.yaml"
	ProdConfig string = "config/appConfig-prod.yaml"
)

func main() {
	container := app.ServiceContainer{make(map[string]interface{}), &config.AppConfig{}}
	err := container.InitApp(ProdConfig)
	if err != nil {
		fmt.Println(err)
		return
	}
	Log.Info(container.AppConfig.Log)
	Log.Info(container.AppConfig.MasterMySqlConfig)
	Log.Info(container.AppConfig.SlaveMySqlConfig)
	Log.Info(container.AppConfig.UserConfig)
	Log.Info(container.AppConfig.UserGrpcConfig)

	if container.AppConfig.Log.Code == "zap" {
		Log.Info(container.AppConfig.ZapConfig)
	}else {
		Log.Info(container.AppConfig.LogrusConfig)
	}

	container.Put("version", "1.0.0")
	result, flag := container.Get("version")
	if flag {
		Log.Infof("version:%v", result)
	}
}
